<include file="public:top" />
<!--编辑菜单-->
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
    <input type="hidden" name="id" value="{$info.id}" />
    <input type="hidden" name="code" value="{$info.code}" />
    <input type="hidden" name="author" value="{$info.author}" />
   
  <div class="layui-form-item">
    <label class="layui-form-label">{:L('item_site_code')}</label>
    <div class="layui-input-block">
      <input type="text"  placeholder="请输入" class="layui-input" value="{$info.code} - 禁止编辑" disabled="">
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">{:L('item_site_name')}</label>
    <div class="layui-input-block">
      <input type="text" name="name" id="J_name" placeholder="请输入" class="layui-input" value="{$info.name}">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">排序</label>
    <div class="layui-input-block">
      <input type="text" name="ordid" id="J_ordid" placeholder="请输入" class="layui-input" value="{$info.ordid}">
    </div>
  </div>
  <volist name="file_info.config" id="config">
  <div class="layui-form-item">
    <label class="layui-form-label">{$config.text}</label>
    <div class="layui-input-block">
        <switch name="config.type">
            <case value="text">
                <input type="text" name="{$key}" class="layui-input" size="30" value="{$info['config'][$key]}">
            </case>
            <case value="select">
                <select name="{$key}">
                    <volist name="config.items" id="item" key="item_key">
                    <option value="{$item_key}" <if condition="$item_key eq $info['config'][$key]">selected</if>>{$item}</option>
                    </volist>
                </select>
            </case>
        </switch>
    </div>
  </div>
  </volist>
   
  <div class="layui-form-item">
        <label class=""></label>
        <div class="layui-input-block">
        <button class="layui-btn" lay-submit="" lay-filter="upbtn">提交保存</button>
        </div>
    </div>
</form>
 
<script>
//Demo
layui.use(['layer','jquery','form','element','laydate'], function () {
   // 操作对象
    var layer = layui.layer,$ = layui.jquery,form = layui.form, element = layui.element , laydate = layui.laydate;
  


   // 提交
    form.on('submit(upbtn)', function (data) {
        // 提交到方法 默认为本身
        $.post("{:U('oauth/edit')}",data.field,function(res){
            if(res.status ==  1){
                layer.msg(res.msg,{time:1800},function(){
                    //关闭弹层后刷新父页面
                    window.parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
                    parent.layer.close(index); 
                });
            }else{
                layer.msg(res.msg,{time:1800},function(){
                    //关闭弹层后刷新父页面
                    window.parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
                    parent.layer.close(index); 
                });
            }
        });
        return false;
    });

    

});
</script>